package com.crrc.dataparse.monitor.base.resource;

import com.crrc.dataparse.monitor.base.resource.xmlParse.XmlParser;
import java.util.HashMap;
import java.util.Map;

public class RegionalRC {
    private static String xmlPath = "";
    private static String xmlPathName = "/home/ubuntu/Export.xml";
    protected static Map<String, IResource> resourceMap = new HashMap();

    protected RegionalRC() {
    }

    public static void setProtocolXml(String filename) {
        xmlPathName = filename;
    }

    public static IResource getResource(String resourceType) {
        return (IResource)resourceMap.get(resourceType);
    }

    public static Object getResourceItem(String resourceType, String resourceKey) {
        IResource resource = (IResource)resourceMap.get(resourceType);
        return resource != null ? resource.getResourceItem(resourceKey) : null;
    }

    public static synchronized void loadResource(String[] resourceTypeArray) {
        XmlParser parser = new XmlParser(xmlPathName);
        String[] var2 = resourceTypeArray;
        int var3 = resourceTypeArray.length;

        for(int var4 = 0; var4 < var3; ++var4) {
            String resourceType = var2[var4];
            IResource resource = (IResource)parser.getResource().get(resourceType);
            resourceMap.put(resourceType, resource);
        }

    }
}

